<template>
  <div class="list">
    <!-- 应该将item传入item组件当中 -->
    <item
      v-for="(item, index) in arr"
      :key="index"
      :item="item"
      :index="index"
      @mouseenter.native="enterItem(index)"
    ></item>
    <!-- 在标签组件上绑定事件需要加.native,如果不加，不能绑定 -->
  </div>
</template>

<script>
import Item from "./Item";
export default {
  props: ["arr"],
  components: {
    Item,
  },
  methods: {
    enterItem(index) {
      /* console.log("组件标签上的事件");
      console.log(index); */
      this.$eventBus.$emit("itemIndex", index + 1);
    },
  },
};
</script>

<style lang="scss" scoped>
</style>